home *** CD-ROM | disk | FTP | other *** search
/ Suzy B Software 2 / Suzy B Software CD-ROM 2 (1994).iso / extras / programm / gemfsc20 / gemfsc20.lzh / GEMFUNCS / APLVWORK.C < prev    next >
C/C++ Source or Header  |  1993-03-20  |  3KB  |  105 lines

  1. /**************************************************************************
  2.  * APLVWORK.C - apl_vopen() and apl_vclose() functions.
  3.  *
  4.  * 01/05/93 -    The Getrez() call that sets the system fonts for the
  5.  *                workstation is always done now, instead of being done
  6.  *                only on the first call to apl_vopen().    Also, the
  7.  *                gl_vwout and gl_vxout arrays are both updated on every
  8.  *                open call, so they always reflect the values of the most
  9.  *                recent open.  I found a need (in Cyber Paint) to have
  10.  *                two workstations open in two different resolutions, and
  11.  *                these changes help.
  12.  *************************************************************************/
  13.  
  14. #include "gemfintl.h"
  15. #include <osbind.h>
  16.  
  17. static short GFAR work_in[11] = {
  18.     -1,                 /* device driver (filled in at runtime) */
  19.     1,                    /* polyline type    (normal)            */
  20.     1,                    /* polyline color    (foreground)        */
  21.     1,                    /* polymarker type    (dot)                */
  22.     1,                    /* polymarker color (foreground)        */
  23.     1,                    /* text face        (standard)            */
  24.     1,                    /* text color        (foreground)        */
  25.     1,                    /* fill interior    (solid)             */
  26.     8,                    /* fill style        (solid)             */
  27.     1,                    /* fill color        (foreground)        */
  28.     2                    /* use RC coordinate system             */
  29. };
  30.  
  31. static short shared_handle = 0;    /* shared workstation handle       */
  32.  
  33. short gl_vwout[57];                /* global work_out from v_opnvwk() */
  34. short gl_vxout[57];                /* global work_out from vq_extnd() */
  35.  
  36. /*-------------------------------------------------------------------------
  37.  * apl_vclose - Close VDI virtual workstation.
  38.  *     if it's the shared workstation, don't really close it.
  39.  *-----------------------------------------------------------------------*/
  40.  
  41. void apl_vclose(vdi_handle)
  42.     register short vdi_handle;
  43. {
  44.     if (vdi_handle == shared_handle) {
  45.         return;
  46.     } else if (vdi_handle != 0) {
  47.         v_clsvwk(vdi_handle);
  48.     }
  49. }
  50.  
  51. /*-------------------------------------------------------------------------
  52.  * cleanup_shared_workstation() - Really close the shared workstation.
  53.  *    this is called from apl_cleanup() via the _AesVCleanup vector.
  54.  *-----------------------------------------------------------------------*/
  55.  
  56. #ifdef GEMFAST_PROTOS
  57.   static void GSTACKARGS cleanup_shared_workstation(void)
  58. #else
  59.   static void GSTACKARGS cleanup_shared_workstation()
  60. #endif
  61. {
  62.     if (shared_handle != 0) {
  63.         v_clsvwk(shared_handle);
  64.         shared_handle = 0;
  65.     }
  66. }
  67.  
  68. /*-------------------------------------------------------------------------
  69.  * apl_vopen() - Routine to open a virtual workstation.
  70.  *-----------------------------------------------------------------------*/
  71.  
  72. short apl_vopen()
  73. {
  74.     short vdi_handle;
  75.  
  76.     if (gl_grfhandle == 0) {
  77.         _ApXinit();
  78.     }
  79.  
  80.     work_in[0] = 2 + Getrez();    /* Set system fonts for workstation */
  81.  
  82.     vdi_handle = gl_grfhandle;
  83.     v_opnvwk(work_in, &vdi_handle, gl_vwout);
  84.  
  85.     if (vdi_handle != 0) {
  86.         vq_extnd(vdi_handle, 1, gl_vxout);
  87.     }
  88.  
  89.     return vdi_handle;
  90. }
  91.  
  92. /*-------------------------------------------------------------------------
  93.  * apl_vshared() - Return the handle to the shared workstation; open the
  94.  *                   shared workstation if necessary;
  95.  *-----------------------------------------------------------------------*/
  96.  
  97. short apl_vshared()
  98. {
  99.     if (shared_handle == 0) {
  100.         _AesVCleanup  = cleanup_shared_workstation;
  101.         shared_handle = apl_vopen();
  102.     }
  103.     return shared_handle;
  104. }
  105.